package week4.num.ExceptionDemo01.neueduTotal.solar;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

public class SolarSystemClient extends MyFrame{

    Background bg=new Background("bg");
    static Sun sun=new Sun("太阳");
    Planet Mercury=new Planet(sun,"1","水星",0.387,0.2056,88,"水星");
    Planet Venus=new Planet(sun,"2","金星",0.72,0.0068,225,"金星");
    Planet earth=new Planet(sun,"3","地球",1.0,0.0167,365,"地球");

    Planet moon=new Planet(earth,"0","月球",0.3,0,365/12,"月球");

    Planet Mars=new Planet(sun,"4","火星",1.52,0.0934,687,"火星");

    static List<Planet> smallPlanets=new ArrayList<>();

    static{
        for (int i = 0; i < 100000; i++) {
            double au = Math.random() * 3 + 2;
            int t= (int) (Math.random()*3300+700);
            Planet smallPlanet=new Planet(sun,"","",au,0,t,"小行星",true);
            smallPlanets.add(smallPlanet);
        }
    }

    Planet Jupiter=new Planet(sun,"5","木星",5.2,0.0489,4330,"木星");
    Planet Saturn=new Planet(sun,"6","土星",9.54,0.0557,10832,"土星");
    Planet Uranus=new Planet(sun,"7","天王星",19.218,0.0444,30777,"天王星");
    Planet Neptune=new Planet(sun,"8","海王星",30.06,0.0112,60328,"海王星");

    @Override
    public void paint(Graphics g) {
        bg.draw(g);
        sun.draw(g);
        Mercury.draw(g);
        Venus.draw(g);
        earth.draw(g);
        moon.draw(g);
        Mars.draw(g);

        for (Planet smallPlanet:smallPlanets) {
            smallPlanet.draw(g);
        }

        Jupiter.draw(g);
        Saturn.draw(g);
        Uranus.draw(g);
        Neptune.draw(g);
    }

    public static void main(String[]args){
        /*Sun sun=new Sun(500,800);
        System.out.println(sun.x);
        Planet earth=new Planet("3","地球",1,0.0167,365);
        earth.run();*/
        new SolarSystemClient().loadFrame();
    }
}
